package bag;
//循环输出多个异常
public class TestDemo2 {

    public static void main(String[] args) {
        int i = 0;
        while (i != 10) {
            try {
                if (i < 10) {
                    throw new Exception();//抛一个异常
                } else {
                    return;
                }
            } catch (Exception e) {
                e.printStackTrace();
                i++;
                System.out.println(i);
            }

        }
        System.out.println( "i=" + i);

    }
}

